package com.hlz.lib.effectivejava.threadlocal;

import com.alibaba.ttl.TransmittableThreadLocal;

import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @author: Castile
 * @create: 2024-04-05 15:53
 * @Version 1.0
 **/
public class TransimiteMain {

    public static void main(String[] args) throws InterruptedException {

        TransmittableThreadLocal<Integer> context = new TransmittableThreadLocal<>();
        context.set(100);

        new Thread(()->{


            Integer value = context.get();
            System.out.println(value);
        }, "child").start();


        TimeUnit.MILLISECONDS.sleep(10000);

    }
}
